﻿using System.Configuration;
using ZilLion.Service.Core.CRMUnities.Config;
using ZL.Web.Utility.Config;
using ZL.Web.Utility.Http;
using ZLWeb.WebApiEntityBase;

namespace ZL.Web.Utility
{
    public class ServiceBase
    {
        public ServiceBase()
        {
        }
        //public string Passport { get; set; }
        public ServiceBase(string passport,string PassportType="2")
        {
            //Passport = Passport;
            Identity.Passport = passport;
            Identity.PassportType = PassportType;
        }

        public ServiceBase(string passport)
        {
            //Passport = Passport;
            Identity.Passport = passport;
            Identity.PassportType = "2";
        }
        public static readonly string Server;
        public static readonly string Server1;
        public static readonly string Server2;
        public static readonly string SmsServer;

        static ServiceBase()
        {
            Server = ConfigurationManager.AppSettings["ServerAddress"];
            Server1 = ConfigurationManager.AppSettings["ServerAddress1"];
            Server2 = ConfigurationManager.AppSettings["ServerAddress2"];
            SmsServer = ConfigurationManager.AppSettings["SMSServerAddress"];
        }

     
        protected IdentityEntity Identity = new IdentityEntity
        {
            ClientName = "WeChatCard",
            ClientVersion = "20141117",
            RandomCode = "001"
        };

        protected readonly IHttpClient httpClient = new HttpNoCompressionClient(); //没有压缩

        protected static string WeiXinTokenserver
        {
            get
            {
                //return "http://localhost:8061";
                return ZLConfig.WeiXinTokenserver;
            }
        }

        protected static string SnoServer
        {
            get { return ZLConfig.SnoServer; }
        }
    }
}
